import { NoviceGiftItemRenderer } from "../../novice/NoviceGiftItemRenderer";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GiftBagInfo } from "../../../model/GiftBagInfo";
import { SWFPlayer } from "../../../scene/modle/SWFPlayer";
import { ModelType } from "../../../scene/modle/data/ModelType";
import { ActionType } from "../../../scene/modle/data/ActionType";
//class FirstRechargeItemRenderer
    
    export  class FirstRechargeItemRenderer extends NoviceGiftItemRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ onAddedToStageHandler(arg1: Object /* flash.events.Event */): void
        {
            this.removeEventListener(flash.events.Event.ADDED_TO_STAGE, this.onAddedToStageHandler);
            this.mouseChildren = true;
            this.mouseEnabled = false;
            return;
        }

        protected /* override */ configUI(): void
        {
            super.configUI();
            _bg.bitmapData = GlobalClass.getBitmapData(ImagesConst.SpecialItemBg);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=arg1.type;
            var loc2=arg1.item as GiftBagInfo;
            if (arg1 == null) 
            {
                _itemData = null;
                _item.itemData = null;
            }
            else 
            {
                _item.amount = loc2.num;
                _itemData = loc2.item;
                _item.itemData = _itemData;
            }
            if ((loc1 == 1 || loc1 == 3) && this._effect == null) 
            {
                this._effect = new SWFPlayer();
                this._effect.loadComplete = this.onEffectLoadComplete;
                addChild(this._effect);
                this._effect.load("firstRechargeBorder" + loc1 + ".swf", ModelType.Skill, null);
            }
            return;
        }

        /* internal  */onEffectLoadComplete(arg1: SWFPlayer): void
        {
            arg1.updateFrame(ActionType.Stand, 1, true);
            arg1.updateCurrentFrame(0);
            arg1.play();
            arg1.move(18, 18);
            if (arg1.movieClipData) 
            {
                arg1.movieClipData.isClear(false);
            }
            return;
        }

        /* internal */ /* var */_effect: SWFPlayer;
    }
